package flc.ast.adapter;

import android.graphics.Color;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.MyBxBean;
import flc.ast.bean.MyOilBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class BxAdapter extends StkProviderMultiAdapter<MyBxBean> {

    public BxAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(40));
        addItemProvider(new BxProvider());
    }

    private class BxProvider extends BaseItemProvider<MyBxBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_bx;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyBxBean bean) {
            baseViewHolder.setText(R.id.tvBxItemText,bean.getText());
            if (bean.isSelected()){
                baseViewHolder.setVisible(R.id.ivBxItemSel,true);
                baseViewHolder.setTextColor(R.id.tvBxItemText, Color.parseColor("#FF99DDFF"));
            }else {
                baseViewHolder.setVisible(R.id.ivBxItemSel,false);
                baseViewHolder.setTextColor(R.id.tvBxItemText, Color.parseColor("#CC222222"));
            }
        }
    }

}
